package com.cn.designpatterns.ex.concrete.observer.objdkimpl;

import java.util.Observable;
import java.util.Observer;

/**
 * @author zhangyi
 * @date 2018/12/25 9:49
 */
public class ObserverJdk implements Observer {

    private String name;

    public ObserverJdk(String name) {
        this.name = name;
    }

    @Override
    public void update(Observable o, Object arg) {
        if(arg instanceof Integer){
            System.out.println(name + "发现,价格已经改变: " + arg);
        }
    }
}
